package com.hqyj.system.service.impl;

import com.hqyj.system.mapper.RoleMapper;
import com.hqyj.system.model.Role;
import com.hqyj.system.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author cz
 * 2021/9/2 11:00
 */
@Service
public class RoleServiceImpl implements RoleService {
    @Autowired
    private RoleMapper roleMapper;

    @Override
    public List<Role> queryAllRole() {
        return roleMapper.queryAllRole();
    }

    @Override
    public int addRoleByRole(Role role) {
        return roleMapper.insertSelective(role);
    }

    @Override
    public int deleteRoleByidStr(int id) {
        return roleMapper.deleteByPrimaryKey(id);
    }

    @Override
    public Role selectRoleByRoleId(int roleId) {
        return roleMapper.selectByPrimaryKey(roleId);
    }

    @Override
    public int updateRoleByRoleId(Role role) {
        return roleMapper.updateByPrimaryKeySelective(role);
    }

    @Override
    public Role queryRoleByUserId(int userId) {
        return roleMapper.queryRoleByUserId(userId);
    }

    @Override
    public Role queryRoleByRoleId(int roleId) {
        return roleMapper.selectByPrimaryKey(roleId);
    }

    @Override
    public List<Role> query_xz_roleByUserId(int userId) {
        return roleMapper.query_xz_roleByUserId(userId);
    }


}
